package three;

import java.awt.List;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Momo {

	public static void main(String[] args) {
		Queue<Integer> Q = new LinkedList<Integer>();
		Queue<Integer> Q1 = new LinkedList<Integer>();
		Queue<Integer> Q2 = new LinkedList<Integer>();
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		for (int i = 0; i < n; i++) {
			int s1 = s.nextInt();
			if (s1 % 2 == 1) {
				Q1.offer(s1);
			} else {
				Q2.offer(s1);
			}
		}
		while (!Q1.isEmpty() || !Q2.isEmpty()) {
			if (!Q1.isEmpty())
				Q.offer(Q1.poll());
			if (!Q1.isEmpty())
				Q.offer(Q1.poll());
			if (!Q2.isEmpty())
				Q.offer(Q2.poll());
		}
		System.out.print(Q.poll()); 
		for (int i = 0; i < n-1; i++) {
			System.out.print(" "+Q.poll());
		}

	}
}
